<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>颜色渐变</title>
    <style>
    .content{
        margin:0 auto;
        clear: both;
    }
    .content li{
        list-style: none;
        float: left;
        margin: 3px;
        width:30px;
        height: 30px;
        padding: 10px;
        background-color: #f00;
    }
    .content li:nth-child(1){
       opacity: 1;
    }
    .content li:nth-child(2){
       opacity: 0.8;
    }
    .content li:nth-child(3){
       opacity: 0.6;
    }
    .content li:nth-child(4){
       opacity: 0.4;
    }
    .content li:nth-child(5){
       opacity: 0.2;
    }
    .rgba li:nth-child(1){
       background-color: rgb(255,0,0,1);
    } 
    .rgba li:nth-child(2){
       background-color: rgb(255,0,0,0.8);
    } 
    .rgba li:nth-child(3){
       background-color: rgb(255,0,0,0.6);
    } 
    .rgba li:nth-child(4){
       background-color: rgb(255,0,0,0.4);
    } 
    .rgba li:nth-child(5){
       background-color: rgb(255,0,0,0.2);
    } 
    /* opacity 用于各种，边框，元素，但是设置透明度后，字体页变了 */
    /* rgba适用于背景，图片，设置背景颜色，文字没有一起变 */
    </style>
</head>
<body>
    <div class="content">
        <ul>
            <li>1</li>
            <li>0.8</li>
            <li>0.6</li>
            <li>0.4</li>
            <li>0.2</li>
        </ul>

    </div>
    <div class="content rgba">
            <ul>
                <li>1</li>
                <li>0.8</li>
                <li>0.6</li>
                <li>0.4</li>
                <li>0.2</li>
            </ul>
    
        </div>
</body>
</html>